// pages/partner/setUserFee.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo:{

     },
    user_id:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.user_id = options.user_id;
    this.getFeeNum();
  },

  setVal: function (e) {
    var name = e.currentTarget.dataset.name;
    var v = e.detail.value;
    var data = this.data.userInfo;
    data[name] = v;
    this.setData({
      userInfo: data
    });
  },

  formSubmit: function (e) {
     
    //手机号登陆
    var that = this;
    that.setData({
      loading: 1,
      disabled: 1
    });
    this.data.userInfo.method = "POST";
    app.api("apiv2/user/setFee", this.data.userInfo, function (res) {
      that.setData({
        loading: 0,
        disabled: 0
      });
      if (res.code != 200) {
        app.alert(res.msg);
        return;
      }
      app.setPageData("user/partnerList", { reload: 1 });
      wx.navigateBack();
  

    });
  },


  getFeeNum() {
    var that = this;
    app.api("apiv2/user/getFeeInfo", { user_id: this.data.user_id}, function (res) {
      if (res.code != 200) {
        app.alert(res.msg);
        return;
      }
      that.setData({ userInfo: res.data })
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})